//
//  HomeModel.m
//  IconMaster
//
//  Created by mac on 2017/8/21.
//  Copyright © 2017年 yangweiwei. All rights reserved.
//

#import "HomeModel.h"

@implementation HomeModel
-(instancetype)initWithDict:(NSDictionary *)dict
{
    if (self = [super init])
    {
        self.coverPath = dict[@"coverPath"];
        self.downString = dict[@"downString"];
        self.timeString = dict[@"timeString"];
        self.IsLocked = [dict[@"IsLocked"] boolValue];
        self.IsVisable = [dict[@"IsVisable"] boolValue];
        self.stringID = [NSString stringWithFormat:@"%@", dict[@"id"]];
    }
    return  self;
}
+ (NSMutableDictionary *)setDictModel:(NSDictionary *)dict{

  
        NSMutableDictionary *infoDict = [NSMutableDictionary dictionary];
        [infoDict setValue:dict[@"coverPath"] forKey:@"coverPath"];
        [infoDict setValue:dict[@"id"] forKey:@"id"];
        [infoDict setValue:[NSString stringWithFormat:@"%@",dict[@"downloadCount"]] forKey:@"downString"];
        [infoDict setValue:[NSString stringWithFormat:@"%@",dict[@"createTime"]] forKey:@"timeString"];
        if ([dict[@"albunIsLocked"] integerValue]) {
            if (![[NSUserDefaults standardUserDefaults] objectForKey:@"IsLocked"]) {
                [[NSUserDefaults standardUserDefaults] setObject:@"IsLocked" forKey:@"IsLocked"];
            }
            
            [infoDict setValue:[NSNumber numberWithBool:YES] forKey:@"IsLocked"];
        }else{
            [infoDict setValue:[NSNumber numberWithBool:NO] forKey:@"IsLocked"];
        }
        return infoDict;
    
   
}
@end
